import request from '@/config/axios'

// 阶段-专业分组设置 VO
export interface StageMajorGroupVO {
  id: string // 专业分组ID
  awardsId: string // 评奖ID
  instanceRuleId: string // 评奖阶段规则设置ID
  majorType: string // 专业类型 材料物理与化学,材料学,材料加工学,腐蚀科学与防护
  phdAmount: number // 博士名额
  masterAmount: number // 硕士名额
  totalAmount: number // 总名额
  remark: string // 备注
}

// 阶段-专业分组设置 API
export const StageMajorGroupApi = {
  // 查询阶段-专业分组设置分页
  getStageMajorGroupPage: async (params: any) => {
    return await request.get({ url: `/awards/stage-major-group/page`, params })
  },

  // 查询阶段-专业分组设置详情
  getStageMajorGroup: async (id: string) => {
    return await request.get({ url: `/awards/stage-major-group/get?id=` + id })
  },

  // 新增阶段-专业分组设置
  createStageMajorGroup: async (data: StageMajorGroupVO) => {
    return await request.post({ url: `/awards/stage-major-group/create`, data })
  },

  // 修改阶段-专业分组设置
  updateStageMajorGroup: async (data: StageMajorGroupVO) => {
    return await request.put({ url: `/awards/stage-major-group/update`, data })
  },

  // 删除阶段-专业分组设置
  deleteStageMajorGroup: async (id: string) => {
    return await request.delete({ url: `/awards/stage-major-group/delete?id=` + id })
  },

  // 导出阶段-专业分组设置 Excel
  exportStageMajorGroup: async (params) => {
    return await request.download({ url: `/awards/stage-major-group/export-excel`, params })
  },

  // 获得指定评奖阶段规则设置的阶段-专业分组设置
  getStageMajorGroupListByRule: async (ruleId: string) => {
    return await request.get({
      url: `/awards/stage-major-group/list-by-rule-id?ruleId=${ruleId}`
    })
  }
}
